package DomainObject;

import java.io.Serializable;
import java.util.ArrayList;

import ca.etsmtl.log720.lab1.Dossier;
import ca.etsmtl.log720.lab1.DossierPOA;
//create by martin souliere
public class DossierImpl extends DossierPOA implements Serializable {

	protected int _id;
	protected String _nom;
	protected String _noPermis;
	protected String _noPlaque;
	protected String _prenom;
	protected ArrayList<Integer> _infractions;
	protected ArrayList<Integer> _reactions;
	public DossierImpl(Dossier current) {
		_id = current.id();
		_nom = current.nom();
		_noPermis = current.noPermis();
		_noPlaque = current.noPlaque();
		_prenom = current.prenom();
		_infractions = new ArrayList<Integer>();
		_reactions = new ArrayList<Integer>();
		for (int i = 0; i < current.getListeInfraction().length; i++) {
			_infractions.add(current.getListeInfraction()[i]);
		}
		for (int i = 0; i < current.getListeReaction().length; i++) {
			_reactions.add(current.getListeReaction()[i]);
		}
	}
	public DossierImpl(int id,String nom, String prenom,String noPermis, String noPlaque) {
		_id = id;
		_nom = nom;
		_noPermis = noPermis;
		_noPlaque = noPlaque;
		_prenom = prenom;
		_infractions = new ArrayList<Integer>();
		_reactions = new ArrayList<Integer>();
	}
	public int id() {
		return _id;
	}

	public String nom() {
		return _nom;
	}

	public String noPermis() {
		return _noPermis;
	}

	public String noPlaque() {
		return _noPlaque;
	}

	public String prenom() {
		return _prenom;
	}

	public int niveau() {
		return 0;
	}

	public int[] getListeInfraction() {
		int[] array = new int[_infractions.size()];
		for (int i = 0; i < _infractions.size(); i++) {
			array[i] = _infractions.get(i);
		}
		return array;
	}

	public int[] getListeReaction() {
		int[] array = new int[_reactions.size()];
		for (int i = 0; i < _reactions.size(); i++) {
			array[i] = _reactions.get(i);
		}
		return array;
	}

	public void ajouterReactionAListe(int idReaction) {
		_reactions.add(idReaction);
		
	}

	public void ajouterInfractionAListe(int idInfraction) {
		_infractions.add(idInfraction);
	}

	public String _toString() {		
		return _noPermis + " " + _prenom + " " + _nom + " " + _noPlaque;
	}

}
